<template>
  <div>
    <el-card shadow="always" class="box-card">
      <div class="tableTitle"><span>基本信息</span></div>
      <div class="devTitle"><span>{{infoDev.standardName}}</span></div>
      <div>
        <div class="tableStyle">
          <div class="labelS">标准编号</div>
          <div class="contentS">{{infoDev.standardNum}}</div>
        </div>
        <div class="tableStyle">
          <div class="labelS">标准名称</div>
          <div class="contentS">{{infoDev.standardName}}</div>
        </div>
        <div class="tableStyle">
          <div class="labelS">所属部门</div>
          <div class="contentS">{{infoDev.deptName}}</div>
        </div>
        <div class="tableStyle">
          <div class="labelS">使用类别</div>
          <div class="contentS">{{infoDev.category}}</div>
        </div>
        <div class="tableStyle">
          <div class="labelS">要求</div>
          <div class="contentS">
            {{infoDev.requirement}}
          </div>
        </div>
        <div class="tableStyle">
          <div class="labelS">备注</div>
          <div class="contentS">
            {{infoDev.remark}}
          </div>
        </div>
      </div>
    </el-card>
    <el-card shadow="always" class="box-card">
      <div class="tableTitle"><span>适用设备</span></div>
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column prop="deviceNum" label="设备编号" ></el-table-column>
            <el-table-column prop="deviceName" label="设备名称" ></el-table-column>
            <el-table-column prop="category" label="类别" > </el-table-column>
            <el-table-column prop="brandName" label="品牌" > </el-table-column>
            <el-table-column prop="specification" label="规格型号"> </el-table-column>
      </el-table>
       <div style="text-align:right;margin-top:20px;">
                <el-pagination
  background
  :pager-count="5"
  layout="total,prev, pager, next"
 small
 :page-size="devPage.pageSize"
 @current-change="handleCurrentChange"
 :current-page.sync="devPage.currentPage"
  :total="devPage.total">
</el-pagination>
            </div>
    </el-card>
    <el-card shadow="always" class="box-card">
      <div class="tableTitle"><span>点检项目</span></div>
      <el-table :data="tableData2" border style="width: 100%">
        <!-- <el-table-column type="index" width="50"> </el-table-column> -->
        <el-table-column prop="itemsNum" label="编号" width="170"> </el-table-column>
        <el-table-column prop="itemsName" label="项目" >
        </el-table-column>
        <el-table-column prop="methodBenchmark" label="方法及基准" width="200"> </el-table-column>
        <el-table-column label="类型"> 
          <template slot-scope="scope">
        <span v-if="scope.row.type==0">文本</span>
        <span v-if="scope.row.type==1">数值</span>
        <span v-if="scope.row.type==2">选项</span>
      </template>
        </el-table-column>
        <el-table-column prop="lowerLimit" label="下限"  width="50"> </el-table-column>
        <el-table-column prop="maxLimit" label="上限" width="50"> </el-table-column>
        <el-table-column prop="optional" label="可选项"> </el-table-column>
        <el-table-column prop="normalOption" label="正常选项"> </el-table-column>
        <!-- <el-table-column prop="pic" label="参考图片"> </el-table-column> -->
      </el-table>
      <div style="text-align:right;margin-top:20px;">
                <el-pagination
  background
  :pager-count="5"
  layout="total,prev, pager, next"
 small
 :page-size="spot.pageSize"
 @current-change="handleCurrentChangeSpot"
 :current-page.sync="spot.currentPage"
  :total="spot.total">
</el-pagination>
            </div>
    </el-card>
  </div>
</template>
<script>
import {
  getRelateDev,getSpotDev,getObj
} from "@/api/ems/inspection/criterion";
export default {
  data() {
    return {
      tableData: [],
      tableData2: [],
      infoDev:{},
      devPage:{
         currentPage: 1,
         total:0,
         pageSize:5,
      },
      spot:{
         currentPage: 1,
         total:0,
         pageSize:5,
      },
      stardId:''
    };
  },
  mounted(){
    this.getInfoList();
     this.getDevDrawe();
     this.getSpotDetail();
  },
  methods:{
    handleCurrentChange(index){
        this.devPage.currentPage = index;
         this.getDevDrawe();
    },
    handleCurrentChangeSpot(index){
     
       this.spot.currentPage = index;
         this.getSpotDetail();
    },
    getSpotDetail(){
       getSpotDev({standardId:this.stardId,size:this.spot.pageSize,current:this.spot.currentPage}).then((res)=>{
            this.tableData2 = res.data.data.records;
            this.spot.total = res.data.data.total;

          })
    },
     getDevDrawe(){
      getRelateDev({standardId: this.stardId,size:this.devPage.pageSize,current:this.devPage.currentPage}).then((res)=>{
            this.tableData = res.data.data.records;
            this.devPage.total = res.data.data.total;
          })
    },
    getInfoList(){
      this.stardId = this.$route.query.info;
       getObj(this.stardId).then((res)=>{
         this.infoDev = res.data.data
       })
         
    }

  },

};
</script>
<style lang="scss" scoped>
.tableTitle {
  color: #333;
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 20px;
}
.devTitle {
  color: #262626;
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 20px;
}
.box-card {
  margin-bottom: 10px;
  .el-card__body {
    padding-top: 10px;
  }
  .labelS {
    width: 150px;
    text-align: left;
    color: #606266;
    padding: 10px;
    border: 1px solid rgba(236, 240, 244, 100);
    margin-bottom: -1px;
  }
  .contentS {
    border: 1px solid rgba(236, 240, 244, 100);
    color: #606266;
    width: 100%;
    margin-left: -1px;
    margin-bottom: -1px;
    padding: 10px;
  }
  .tableStyle {
    display: flex;
  }
}
</style>
